// polygon defination 


#include "Polyline.h"



Polyline::Polyline(){

     points = new Matrix(1,1);
}


Polyline::Polyline(const MyDisplay &another):Line(another){

   //Polyline();   

  points = new Matrix(1,1);
}

Polyline::Polyline(const Matrix &R){


   points = new Matrix(R);
     
}


Polyline::Polyline(const char *fileName,const MyDisplay &another):Line(another){

     points = new Matrix(fileName);    
 
      
}


Polyline::~Polyline(){

}


bool Polyline::draw(){

  int i;

 for(i =0;i< (points->numRows())-1 ;i++)
   drawLine((double)(*points)[i][0],(double)(*points)[i][1],(double)(*points)[i+1][0],(double)(*points)[i+1][1]);
	
//  points->disp(); 
  
  
  
return true;
}




bool Polyline::draw(const Matrix &T){

    (*points) = T;
    
    draw();
    
   return true;
}

bool Polyline::draw(const char *fileName){

     Matrix T(fileName);
     
     (*points) = T;
     
     draw();
     
     return true;
}

bool Polyline::change(const int x,const int y){

    
       for(int i = 0;i<points->numRows();++i){
       
          (*points)[i][0] = (*points)[i][0] + x;
	  (*points)[i][1] = (*points)[i][1] + y;
        }
         
   return true;
}
